package no.ntnu.fp.watch.gui;

import java.awt.Color;
import java.sql.Timestamp;
import java.text.SimpleDateFormat;
import java.util.ArrayList;


/**
 * 
 * Class representing an event. An event is created when the status of a well changes. 
 * 
 * @author Christian
 *
 */
public class Event {
	
	private int eventid;
	private Timestamp starttime;
	private Timestamp endtime;
	private String color;
	private int falseAlarm;
	private int wellid;
	private String comment;
	
	
	public Event(int eventid, Timestamp start, Timestamp end, String c, int falseAlarm, int wellid){
		this.setEventid(eventid);
		this.setStarttime(start);
		this.setEndtime(end);
		this.setFalseAlarm(falseAlarm);
		this.setWellid(wellid);
		this.color = c;
		this.comment = "";
		
	}


	public void setEventid(int eventid) {
		this.eventid = eventid;
	}


	public int getEventid() {
		return eventid;
	}


	public void setStarttime(Timestamp starttime) {
		this.starttime = starttime;
	}


	public String getStarttime() {
		return new SimpleDateFormat("hh:mm:ss dd/mm/yyyy").format(this.starttime);
	}


	public void setEndtime(Timestamp endtime) {
		this.endtime = endtime;
	}


	public String getEndtime() {
		return new SimpleDateFormat("hh:mm:ss dd/mm/yyyy").format(this.endtime);
	}


	public String getColorAsString() {
		if(this.color.equals("RED")) {
			return "#ff0000";
		}
		else if(this.color.equals("YELLOW")){
			return "#ffff00";
		}
		else if(this.color.equals("GREEN")){
			return "#00ff00";
		}
		return "#ffffff";
	}


	public void setFalseAlarm(int falseAlarm) {
		this.falseAlarm = falseAlarm;
	}


	public int isFalseAlarm() {
		return this.falseAlarm;
	}

	
	public void setWellid(int wellid) {
		this.wellid = wellid;
	}


	public int getWellid() {
		return wellid;
	}


	public void setComment(String comment) {
		this.comment = comment;
	}

	public String getComment() {
		return comment;
	}
	
}
